{include file="public_iframe:head"}
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>会员编辑</h5>
            <div class="ibox-tools" style="margin-top: -9px;">
                <a href="javascript:history.go(-1);" class="btn btn-primary"><i class="fa fa-arrow-left"></i> 返回</a>
            </div>
        </div>
        <div class="ibox-content">
            <form action="" method="post" enctype="multipart/form-data" id="brandForm" class="form-horizontal">
                <input type="hidden" name="id" value="{$da.id}">
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">昵称</label>
                    <div class="col-sm-6">
                        <input type="text" name="account" id="account" value="{$da.account}" class="form-control" placeholder="昵称" disabled>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">登录时间</label>
                    <div class="col-sm-6">
                        <input type="text" name="logintime" id="logintime" value="{if condition='!empty($da.logintime)'}{$da.logintime|date='Y-m-d H:i:s',###}{/if}" class="form-control" disabled>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">注册时间</label>
                    <div class="col-sm-6">
                        <input type="text" name="creatime" id="creatime" value="{$da.creatime|date="Y-m-d H:i:s",###}" class="form-control" disabled>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">零钱</label>
                    <div class="col-sm-2">
                        <input type="text"  value="{$da.balance}" class="form-control" placeholder="零钱"  disabled>
                    </div>
                    <div class="col-sm-2">
                        <input type="text" name="balance" id="balance" value="" class="form-control" placeholder="充值金额" >
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">状态</label>
                    <div class="col-sm-6">
                        <label class="checkbox-inline">
                            <input type="radio" name="status"  value="1"  {if condition="$da.status eq '1'"} checked="checked"{/if} >启用
                        </label>
                        <label class="checkbox-inline">
                            <input type="radio" name="status"  value="0"  {if condition="$da.status eq '0'"} checked="checked"{/if}>禁用
                        </label>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-2">
                     <a href="JavaScript:void(0);" onclick="Submit();" class="btn btn-primary" id="submit">保存</a>
                </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-2">
                        <!--<button class="btn btn-primary" type="submit">提交</button>-->
                        <!--href="JavaScript:void(0);" onclick="roleSubmit();"-->
                        <!--<a href="JavaScript:void(0);" onclick="Submit();" class="btn btn-primary" id="submit">提交</a>-->
                    </div>
                </div>
            </form>
        </div>
    </div>
    <!-- End Panel Basic -->
</div>
<script type="text/javascript" src="__STATIC__/laydate/laydate.js"></script>
<script>
    function Submit(){
        var id = $('input[name="id"]').val();
        var balance = $('input[name="balance"]').val();
        var status = $('input[name="status"]:checked').val();

        if(balance < 0){
            parent.layer.alert('金额有误!',{
                skin: 'layui-layer-molv' //样式类名
                ,closeBtn: 0
            });
            return false;
        }

        $.post("{:url('AdminMember/add')}",{
            id:id, balance:balance,status:status
        },function(result){
            if(result.code == '0'){
                parent.layer.alert(result.msg,{
                        skin: 'layui-layer-molv' //样式类名
                        ,closeBtn: 0
                      });
            }else{
                parent.layer.msg(result.msg,{
                            icon:1,
                            time:1000,
                        },
                        function (index, item) {
                            location.href = result.url;
                        });
            }
        });

    };
</script>
</body>

</html>